from pydoc import describe

from const import cmd_path


def genGolangCmdfile(cmdprotos):
    fileContent = ""
    fileContent += (
    'package msg'
    '\n'
    '\n'
    '// 这里我们注册 protobuf 消息命令)\n'
    'type ClientCmd int32'
    '\n'
    'const ( '
    '\n'
    )

    cmdArrays = []
    for item in cmdprotos:
        fieds=item.split("_")
        code=fieds[0]
        name=fieds[1]
        desc=fieds[2]
        # fileContent += '' \
        #            '    Cmd'
        # fileContent +=name
        cmdName='Cmd'+name
        cmdArrays.append(cmdName)
        # fileContent +=' ClientCmd'
        # fileContent += '= '
        # fileContent += code
        # fileContent += '//'
        # fileContent += desc

    # fileContent += ("\n)")
    #
    # fo = open(cmd_path, "wb")
    # fo.write(fileContent.encode('utf-8'))
    # fo.close()

    return cmdArrays